#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <iostream>
#include "feca/storage_policies.h"

TEST(MemStorageTest, test)
{
    MemStorage<unsigned int, unsigned int> storage;
    ASSERT_TRUE(storage.empty());
    for (unsigned int i = 0; i < 100; ++i)
    {
        storage.insert(i, i);
    }
    ASSERT_FALSE(storage.empty());
    ASSERT_EQ(100, storage.size());
    storage.clear();
    ASSERT_TRUE(storage.empty());
    for (unsigned int i = 0; i < 100; ++i)
    {
        storage.insert(std::pair<unsigned int, unsigned int>(i, i));
    }
    ASSERT_FALSE(storage.empty());
    ASSERT_EQ(100, storage.size());
    for (unsigned int i = 0; i < 100; ++i)
    {
        unsigned int* z = storage.get(i);
        ASSERT_EQ(i, *z);
    }
    for (unsigned int i = 0; i < 100; ++i)
    {
        ASSERT_TRUE(storage.contains(i));
    }
}
